
<%--
 *  File:   BusinessInfoBuyStockData.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		   Changes
 *  2011-6-20	  JackYin		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "R30010,A0114";
  String strTableName = "v_zylbusinessalesinfostock";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/inc/Security.inc"%>

<html>
<head>
<title>BusinessInfoBuyStockData.jsp</title>
<PageFlow:CheckPageFlow pageName="p_zylbusinessareainfobuystock" />
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>
<%
HashMap userinfo = (HashMap)session.getAttribute("userinfo");
Integer  issalesman = (Integer) userinfo.get("issalesman");
String  username = (String) userinfo.get("employeename");
String flag = (String)request.getParameter("flag");
java.util.Calendar cal = java.util.Calendar.getInstance();   
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
    var startyears = document.cform.startyears.value;
	var startmonths = document.cform.startmonths.value;
	var endyears = document.cform.endyears.value;
	var endmonths = document.cform.endmonths.value;
   if(Number(startyears) > Number(endyears)){
	  //alert("?????????");
	  alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	  return;
	}else {
	  if(Number(startyears) == Number(endyears)){
	   if(Number(startmonths) > Number(endmonths)){
	      alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	     return;
	   }
	  }
	}
  editform.action = "BusinessInfoBuyStockData.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.radiorow[idx].checked=true;
  //cform.orgid.value = eval('obj.all.orgid'+idx).value;
  //cform.productid.value = eval('obj.all.productid'+idx).value;
 cform.year.value = eval('obj.all.year'+idx).value;
  cform.month.value = eval('obj.all.month'+idx).value;
}




//salesman
function popRep() {
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>";
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getsecond 
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_zylbusinessareainfobuystock");
	datahandler.runDataHandler();
  }



function page_getbusinessarea(){
	var objdeptcode=eval("cform.proviceofficelist");
	var regionid = document.cform.regionid.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , regionid , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_zylbusinessareainfobuystock");
	datahandler.runDataHandler();
 }


function page_excel(){
	var id = document.cform.userid.value;	
	var deptcode = document.cform.deptcode.value;
	var begindate = document.cform.startyears.value+"-"+document.cform.startmonths.value;
	var enddate = document.cform.endyears.value+"-"+document.cform.endmonths.value;
	var startyears = document.cform.startyears.value;
	var endyears = document.cform.endyears.value;
	var startmonths = document.cform.startmonths.value;
	var endmonths =document.cform.endmonths.value;
	
    var searchname = document.cform.searchname.value;
	var searchvalue = document.cform.searchvalue.value;
	if(searchvalue=="" || searchvalue==null)searchvalue=-1;
	var categorycode = document.cform.categorycode.value;
		
	var dtlevel = document.cform.dtlevel.value;
	var stockdiff = document.cform.stockdiff.value;
	var isadmin = document.cform.isadmin.value;
	if(deptcode=='YL010110'){
		categorycode='002';
	}
    if(Number(startyears) > Number(endyears)){
	  alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	  return;
	}else {
	  if(Number(startyears) == Number(endyears)){
	   if(Number(startmonths) > Number(endmonths)){
	      alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	     return;
	   }
	  }
	}
    var url;
	<%if (new Integer(1).equals(issalesman)){%>
	    url="<%=newreportURL %>/xlsrpt?reportname=BusinessInfoBuyStock&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&timestamp="+Date.parse(new Date())+"&<%= OvalTools.randomURL() %>";
 		//window.open("<%= reportURL %>/servlet/ExcecuteReport/BusinessInfoBuyStock.sox?__format=xlsx&__folder=/ovalreport&rownum=2&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff);	
	<% }else{  %>
    var userids =document.cform.userids.value;	
	var areaids = document.cform.areaids.value;
	if(deptcode=='YL010110'){
		url="<%=newreportURL %>/xlsrpt?reportname=BusinessInfoBuyStock&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids+"&timestamp="+Date.parse(new Date())+"&<%= OvalTools.randomURL() %>";
		//window.open("<%= reportURL %>/servlet/ExcecuteReport/BusinessInfoBuyStock.sox?__format=xlsx&__folder=/ovalreport&rownum=2&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids);	
	} else {
		var salesman =document.cform.userid.value;
		url="<%=newreportURL %>/xlsrpt?reportname=BusinessInfoBuyStock&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids+"&timestamp="+Date.parse(new Date())+"&<%= OvalTools.randomURL() %>";
 		//window.open("<%= reportURL %>/servlet/ExcecuteReport/BusinessInfoBuyStock.sox?__format=xlsx&__folder=/ovalreport&rownum=2&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids);	
 	}
 	<% }%>
 	if(isadmin != 'Y'){
 		url=url+"&employeeid="+ id;
	}else{
		url=url+"&employeeid=";
	}
 	DataReport(url);
	 /* var objform = document.createElement("form");
	 document.body.appendChild(objform);
	 var indexQM = url.indexOf("?");
	 var actionurl = url.substring(0, indexQM);  
	 var query = url.substring(indexQM + 1); 
	 if(indexQM>=0){
	 var params= url.substring(indexQM+1).split("&");
	 for(var i=0; i < params.length; i++){
	  var keyValuePair =params[i].split("=");
	  var input = document.createElement("input");
	     input.type="hidden";
	     input.name  = keyValuePair[0];
	     input.value = keyValuePair[1];
	     objform.appendChild(input);
	   }
	 }
	 objform.action = url;
	 objform.target = "_blank";
	 objform.method = "POST";
	 objform.submit();
	 //删除该 form  
	 document.body.removeChild(objform);  */
 }

function page_csv(){
 	var id = document.cform.userid.value;	
	var deptcode = document.cform.deptcode.value;	
    var begindate = document.cform.startyears.value+"-"+document.cform.startmonths.value;
	var enddate = document.cform.endyears.value+"-"+document.cform.endmonths.value;
	var startyears = document.cform.startyears.value;
	var startmonths = document.cform.startmonths.value;
	var endyears = document.cform.endyears.value;
	var endmonths = document.cform.endmonths.value;
	var searchname = document.cform.searchname.value;
	var searchvalue = document.cform.searchvalue.value;
	var isadmin = document.cform.isadmin.value;
	if(searchvalue=="" || searchvalue==null)searchvalue=-1;
	var categorycode = document.cform.categorycode.value;
	if(deptcode=='YL010110'){
		categorycode='002';
	}
	var dtlevel = document.cform.dtlevel.value;
	var stockdiff = document.cform.stockdiff.value;
	var url;
	<%if (new Integer(1).equals(issalesman)){%>
        url="<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&zip=true";
   		//window.open("<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff);	
	<% }else{  %>
    var userids =document.cform.userids.value;
	var areaids = document.cform.areaids.value;
	if(deptcode=='YL010110'){
		url="<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids+"&zip=true";
   		//window.open("<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids);	
	}
	else {
		var salesman =document.cform.userid.value;
		url="<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids+"&zip=true";
 		//window.open("<%= reportURL %>/csv?__report=/ovalreport/DealerPOSData.txt&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&dtlevel="+dtlevel+"&stockdiff="+stockdiff+"&employeeids="+userids+"&areaids="+areaids);	
 	}
 	<% }%>
 	if(isadmin != 'Y'){
 		url=url+"&employeeid="+ id;
 	}else{
		url=url+"&employeeid=";
	}
 	DataReport(url);
 	/*  var objform = document.createElement("form");
	 document.body.appendChild(objform);
	 var indexQM = url.indexOf("?");
	 var actionurl = url.substring(0, indexQM);  
	 var query = url.substring(indexQM + 1); 
	 if(indexQM>=0){
	 var params= url.substring(indexQM+1).split("&");
	 for(var i=0; i < params.length; i++){
	  var keyValuePair =params[i].split("=");
	  var input = document.createElement("input");
	     input.type="hidden";
	     input.name  = keyValuePair[0];
	     input.value = keyValuePair[1];
	     objform.appendChild(input);
	   }
	 }
	 objform.action = url;
	 objform.target = "_blank";
	 objform.method = "POST";
	 objform.submit();
	 //删除该 form  
	 document.body.removeChild(objform); */
 }

function checkBoxSeleceed(){
	var obj =document.getElementsByName("deleteids");
	var objLen = obj.length;
	var j=0;
	var m=0;
	for (j==0;j<objLen;j++){
       if(obj[j].checked==true){
           m++;
       }
	}
	return m;
}

function page_clear(){
	//document.cform.regionid.value="";
	//document.cform.proviceofficelist.value="";
	//document.cform.businessarealist.value="";
	document.cform.areaids.value = "";
	document.cform.businessareaname.value = "";
	document.cform.employeename.value="";
	cform.userids.value="";
	cform.employeecode.value="";
	
}
function changecategorycode(){
	
	var categoryIndex = cform.categoryid.options[cform.categoryid.selectedIndex].value;
	if(categoryIndex =="" || categoryIndex==null)cform.categorycode.value="";
	if(categoryIndex == 4 )cform.categorycode.value = "001";
	if(categoryIndex == 5 )cform.categorycode.value = "002";
	
}
function onLoad(){
	<%
	String strcatid = "";
	if(pageContext.getAttribute("categoryid")=="" || pageContext.getAttribute("categoryid")==null){
		strcatid = "-1";
	}else{
		strcatid = (Integer)pageContext.getAttribute("categoryid")+"";
	}
	%>
	<%if(strcatid.equals("4")){%>
	cform.categoryid.options[1].selected=true;
	<%}else if(strcatid.equals("5")){%>
	cform.categoryid.options[2].selected=true;
	<%}else{%>
	cform.categoryid.options[0].selected=true;
	<%}%>
	}
	function popBusinessarea_moulty(){
	if(popwindow!=null) popwindow.close();
	
    //url = '<%=contextPath %>/zyl/masterdata/map/SelectAreaTree.jsp?<%= OvalTools.randomURL() %>';
    url = '<%=contextPath %>/phap/phap.datp/masterdata/cm/dataclean/ZylStdareaSelect.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=600, width=900,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}
function setAreas(areaids,areanames,areacodes){

	document.cform.areaids.value = areaids;
	document.cform.businessareaname.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 
</script>

<style type="text/css">
*{padding:0;margin:0;}
.container {width:230px;margin:1px auto;}
.holder2 {color:#FDFAC5;}
/*wu tu yuan jiao*/
.b1 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; margin:0 5px;background-color:#FDFAC5}
.b2 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:2px solid #FDFAC5; border-left:2px solid #FDFAC5; margin:0 3px;background-color:#FDFAC5}
.b3 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 2px;background-color:#FDFAC5}
.b4 {height:2px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 1px;background-color:#FDFAC5}
.content {border-right:1px solid #FDFAC5; height:15px;border-left:1px solid #FDFAC5;background-color:#FDFAC5}
</style>

</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value="p_zylbusinessareainfobuystock" />
	<input type="hidden" name="actionname" /> 
	<input type="hidden" name="categorycode" /> 
	<input type="hidden" name="mark" value="1" /> 
	<custom:hidden property="isadmin" name="userinfo" scope="session"></custom:hidden> 
	<custom:hidden property="userid" name="userinfo" scope="session"></custom:hidden> 
	<custom:hidden property="deptcode" name="userinfo" scope="session"></custom:hidden> <%--  page location   --%>
	<custom:hidden property="year" name="periodmanager"></custom:hidden>
	<custom:hidden property="month" name="periodmanager"></custom:hidden>
<%@ include file="/inc/PageLocation.inc"%> <custom:hidden
	property="globalpccode"></custom:hidden>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td class="summary_top" width="10%" colspan="3"></td>
			</tr>
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<%
					String year = null;
					String month = null;
					/*if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  */
					if("first".equals(flag)){ 
						HashMap periodmanager = (HashMap)pageContext.getAttribute("periodmanager");
						if(null == periodmanager){
							year = cal.get(Calendar.YEAR)+"";     
						    month = cal.get(Calendar.MONTH)+"";
						    if(cal.get(Calendar.MONTH) == 0){
								month = "12";
								year = (cal.get(Calendar.YEAR)-1)+"";
							}
						}else{
							year= periodmanager.get("year")+"";
							month=periodmanager.get("month")+"";
						}
				%>
				
				<%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
				<custom:selectdic property="startyears" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1" />
				<custom:selectdic property="startmonths" dictType="Months" command="notnull" value="<%=month %>" label="L_Month" /> - <custom:selectdic property="endyears" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1" />
				<custom:selectdic property="endmonths" dictType="Months" command="notnull" value="<%=month %>" label="L_Month" />
				</td>
				<td style="width:70px;" class="td_right"><%=label.getLabelName("L_ProdCategory") +  label.getLabelName("L_Colon") %></td>
				<td style="width:40px;" class="td_left"><custom:selectdic
					property="categoryid" dictType="PatentOrPopular" value="4,5"
					defaultValueCost="" defaultValue="-----------"
					onchange="changecategorycode();"></custom:selectdic></td>
				<td style="width:80px;"  class="td_right" ><%=label.getLabelName("L_BGrade") +  label.getLabelName("L_Colon") %></td>
				<td style="width:40px;" class="td_right"><custom:selectdic property="dtlevel" dictType="DealersLevel"
					defaultValue="-----------" defaultValueCost="" /></td>
				<td class="td_right"><%=label.getLabelName("L_MonthStockDIF") +  label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic property="stockdiff" dictType="StockDiff"
					defaultValue="------" defaultValueCost="" /></td>
				<td colspan="7">
				<div class="container">
				<div class="holder"><b class="b1"></b><b class="b2"></b><b
					class="b3"></b><b class="b4"></b>
				<div class="content">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;<font size="3"><b><%=label.getLabelName("L_TIP_SPAN") %></b></font>&nbsp;:&nbsp;&nbsp;<%=label.getLabelName("L_TIP_SPAN_VIEW") %>
				&nbsp;<%=label.getLabelName("L_CLTIME") %>:<custom:write property="cledate" />
				&nbsp;<%=label.getLabelName("L_MBTIME") %>:<custom:write property="backdate" />
				&nbsp;<%=label.getLabelName("L_MCTIME") %>:<custom:write property="coldate" /></p>
				</div>
				<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
				</div>
				</div>
				</td>
				<%}else{ %>
				<td>
				<%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %>
				<custom:selectdic property="startyears" dictType="Years" command="notnull" label="L_Year1" />
				<custom:selectdic property="startmonths" dictType="Months" command="notnull" label="L_Month" /> - <custom:selectdic property="endyears" dictType="Years" command="notnull" label="L_Year1" />
                <custom:selectdic property="endmonths" dictType="Months" command="notnull" label="L_Month" />
				</td>	
				<td style="width:80px;" class="td_right"><%=label.getLabelName("L_ProdCategory") +  label.getLabelName("L_Colon") %></td>
				<td style="width:40px;" class="td_left"><custom:selectdic
					property="categoryid" dictType="PatentOrPopular" value="4,5"
					defaultValueCost="" defaultValue="-----------"
					onchange="changecategorycode();"></custom:selectdic></td> 
				<td style="width:80px;"  class="td_right"><%=label.getLabelName("L_BGrade") +  label.getLabelName("L_Colon") %></td>
				<td style="width:40px;" class="td_right"><custom:selectdic property="dtlevel" dictType="DealersLevel"
					defaultValue="-----------" defaultValueCost="" /></td>
				<td  style="width:70px;"  class="td_right"><%=label.getLabelName("L_MonthStockDIF") +  label.getLabelName("L_Colon") %></td>
				<td style="width:40px;" class="td_left"><custom:selectdic property="stockdiff" dictType="StockDiff"
					defaultValue="------" defaultValueCost="" /></td>
				<td colspan="4">
				<div class="container">
				<div class="holder"><b class="b1"></b><b class="b2"></b><b
					class="b3"></b><b class="b4"></b>
				<div class="content">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;<font size="3"><b><%=label.getLabelName("L_TIP_SPAN") %></b></font>&nbsp;:&nbsp;&nbsp;<%=label.getLabelName("L_TIP_SPAN_VIEW") %>
				&nbsp;<%=label.getLabelName("L_CLTIME") %>:<custom:write property="cledate" />&nbsp;<%=label.getLabelName("L_MBTIME") %>:<custom:write property="backdate" />&nbsp;<%=label.getLabelName("L_MCTIME") %>:<custom:write property="coldate" />
				</p>
				</div>
				<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
				</div>
				</div>
				</td>
				<%
	        	    }
			        %>
			</tr>
			<% 
	                 if (new Integer(1).equals(issalesman)){
	             %>
			<%}else{ %>
			<tr>
			    <!-- 
				<td style="width:220px;" class="td_left"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %>
				<custom:select
					property="regionid" optionInnerTextKey="regionname"
					style="width:160px" optionsName="resultregion"
					optionValueKey="regionid" onchange="page_getpriviceoffice()"
					defaultValue="ALL" defaultValueCost="" />
				</td>
				<td class="td_left"><%=label.getLabelName("L_Department") +  label.getLabelName("L_Colon") %></td>
				<td style="width:90px;" class="td_left">
				<custom:select
					property="proviceofficelist" optionInnerTextKey="proviceofficename"
					optionsName="resultproviceoffice"
					optionValueKey="proviceofficecode" defaultValue="----------"
					style="width:150px" defaultValueCost=""
					onchange="page_getbusinessarea();" />
			    </td>
			     
				<td style="width:60px;" class="td_left"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
				<td style="width:190px;" class="td_left">
				<custom:select
					property="businessarealist" optionInnerTextKey="businessareaname"
					optionsName="resultbusinessarea" optionValueKey="businessareacode"
					defaultValue="----------" style="width:180px" defaultValueCost="" /></td>
			    -->
			    <!--
			    			    <td  class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
			    <td style="width:160px;" class="td_left"> <custom:hidden  property="areaids" />
					<custom:text  property="businessareaname"  label="L_BusinessAreaName" readonly="true"/>
					<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>	
		        </td>
			    -->
			    <td  class="td_right"><%=label.getLabelName("L_Provicetdr") +  label.getLabelName("L_Colon") %></td>
			    <td style="width:160px;" class="td_left"> <custom:hidden  property="areaids" />
						<custom:text  property="businessareaname"  label="L_BusinessAreaName" readonly="true"/>
						<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>	
		      </td>
		        
		        
				<td style="width:70px;" class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				<custom:text property="employeename"
					size="20" readonly="true" style="border:1px #7F9DB9 solid;" /> <a
					onClick="javascript:popRep();"><custom:button type="3"
					label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> <custom:hidden
					property="userids" /> <custom:hidden property="employeecode" />
				</td>
				<td>
				<button type="button" onclick="page_clear()" class="button1"
					name="re" value="clear" style="width:60"><%=label.getLabelName("L_Clear") %></button>
				</td>
				<%} %>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
		<div style="width:100%;height=380;overflow=auto;">
		<table width="180%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">
				<td width="22">&nbsp;</td>
				<td width="90"><%=label.getLabelName("L_YearF")%></td>
				<td width="90"><%=label.getLabelName("L_Month")%></td>
				<td width="150"><%=label.getLabelName("L_areaname")%></td>
				
				<td width="100"><%=label.getLabelName("L_ManagerCode")%></td>
				<td width="200"><%=label.getLabelName("L_ManagerName")%></td>
				<td width="200"><%=label.getLabelName("L_Employeecode")%></td>
				<td width="120"><%=label.getLabelName("L_employeenameDelegate")%></td>

				<td width="100"><%=label.getLabelName("L_TradeNo")%></td>
				<td width="400"><%=label.getLabelName("L_TradeName")%></td>
				<td width="140"><%=label.getLabelName("L_BGrade")%></td>
				<td width="140"><%=label.getLabelName("L_Proy")%></td>
				<td width="140"><%=label.getLabelName("L_Chain")%></td>
				<td width="110"><%=label.getLabelName("L_ProdCode")%></td>
				<td width="240"><%=label.getLabelName("L_ProdName")%></td>
				<td width="130"><%=label.getLabelName("L_PordSpan")%></td>

				<td width="150"><%=label.getLabelName("L_LastInv")%></td>
				<td width="150"><%=label.getLabelName("L_LastAmount")%></td>
				<td width="150"><%=label.getLabelName("L_ThisInv")%></td>
				<td width="150"><%=label.getLabelName("L_ThisAmount")%></td>
				<td width="150"><%=label.getLabelName("L_ThisSales")%></td>
				<td width="150"><%=label.getLabelName("L_ThisSalesAmount")%></td>
				<td width="150"><%=label.getLabelName("L_MonthSJStock")%></td>
				<td width="150"><%=label.getLabelName("L_MonthZTStock")%></td>
				<td width="150"><%=label.getLabelName("L_MonthStockHJ")%></td>
				<td width="150"><%=label.getLabelName("L_InvTotalAmount")%></td>
				<td width="150"><%=label.getLabelName("L_MonthStockJS")%></td>
				<td width="150"><%=label.getLabelName("L_MonthStockDIF")%></td>
				<td width="150"><%=label.getLabelName("L_InvDiffAmount")%></td>
			</tr>

			<%
     ArrayList detailTdArray = new ArrayList();
     detailTdArray.add(new RadioTD());
     detailTdArray.add(new WriteTD("year"));
     detailTdArray.add(new WriteTD("month"));
     detailTdArray.add(new WriteTD("area1name"));
     
     detailTdArray.add(new WriteTD("parentsalesrepcode"));
     detailTdArray.add(new WriteTD("parentsalesrepname"));
     
     detailTdArray.add(new WriteTD("salesrepcode"));
     detailTdArray.add(new WriteTD("salesrepname"));
     detailTdArray.add(new WriteTD("orgcode"));
     detailTdArray.add(new WriteTD("orgname"));
     detailTdArray.add(new WriteTD("organalysisattr1"));
     detailTdArray.add(new WriteTD("businesspropertystr"));
     detailTdArray.add(new WriteTD("ischainstr"));
     detailTdArray.add(new WriteTD("productcode"));
     detailTdArray.add(new WriteTD("productname"));
     detailTdArray.add(new WriteTD("specname"));
     detailTdArray.add(new WriteTD("initialqty"));
     detailTdArray.add(new WriteTD("initialqtyamount"));
     
     detailTdArray.add(new WriteTD("totalpurchaseqty"));
	 detailTdArray.add(new WriteTD("purchaseamount"));
     detailTdArray.add(new WriteTD("salesqty"));
	 detailTdArray.add(new WriteTD("salesamount"));
	 detailTdArray.add(new WriteTD("stockqty"));
	 detailTdArray.add(new WriteTD("intransitqty"));
	 detailTdArray.add(new WriteTD("allqty"));
	 detailTdArray.add(new WriteTD("allamount"));
     detailTdArray.add(new WriteTD("theoryqty"));
     detailTdArray.add(new WriteTD("differenceqty"));
	 detailTdArray.add(new WriteTD("differenceamount"));
  
     
     
     ArrayList hiddenArray = new ArrayList();
     //hiddenArray.add(new HiddenInput("year",true));
     //hiddenArray.add(new HiddenInput("month",true));
 %>
			<custom:iteratetr tdArray="<%=detailTdArray%>"
				hiddenArray="<%=hiddenArray%>" dataSource="totalsummary" />
			<tr>
				<td colspan="16" style="text-align:right"><%=label.getLabelName("L_PageSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red"><b><custom:write name="sumhash"
					property="suminitialqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="suminitialqtyamount" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="sumpurchaseqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumpurchaseamount" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="sumsalesqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumsalesamount" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="sumstockqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumintransitqty" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash" property="sumallqty"
					nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumallamount" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="sumtheoryqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumdifferenceqty" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="sumdifferenceamount" nbsp="true" /></b></td>
			</tr>
			<tr>
				<td colspan="16" style="text-align:right"><%=label.getLabelName("L_TotalSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussuminitialqty" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussuminitialqtyamount" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="bussumpurchaseqty" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumpurchaseamount" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="bussumsalesqty" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumsalesamount" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="bussumstockqty" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumintransitqty" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="bussumallqty" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumallamount" nbsp="true" dataType="number"
					dataFormatName="qtyviewformat" /></b></td>

				<td class="red"><b><custom:write name="sumhash"
					property="bussumtheoryqty" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumdifferenceqty" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>
				<td class="red"><b><custom:write name="sumhash"
					property="bussumdifferenceamount" dataType="number"
					dataFormatName="qtyviewformat" nbsp="true" /></b></td>
				<%@ include file="/inc/SummaryAction.inc"%>
			</tr>

		</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center"><a onclick="page_excel();"><custom:button
					type="1" label="L_ExcelE" imgsrc="Modify.gif" border="0"
					style="width:100" privilegeCode="MB-SYJXC01"/></a>&nbsp;&nbsp; <a onclick="page_csv();"><custom:button
					type="1" label="L_ExportCSV" imgsrc="Modify.gif" border="0"
					style="width:100" privilegeCode="MB-SYJXC02"/></a>&nbsp;&nbsp;</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</body>
<script>
onLoad();
changecategorycode();
</script>
</html>

